<template>
  <div id="shop-description-page" class="shop-page"  v-if="shop.id>0"
       :style="{
    paddingTop:(this.getSafeArea().top)+'px',
    height:(getWinSize().height-50-this.getSafeArea().top)+'px'
  }">
    <!--店铺头部-->
    <shop-header  v-if="shop.id>0" :shop="shop" :style="{top:(this.getSafeArea().top)+'px'}"/>

    <div id="shop-map"  style="padding-top: 110px">
      <iframe :src="getMapSrc()" frameborder="0"></iframe>
    </div>
    <div class="info-box" id="shop-address">
      <div class="title">详细地址</div>
      <div class="value" v-text="shop.province+','+shop.city+','+shop.county+' '+shop.address"></div>
    </div>

    <div class="info-box" id="shop-address">
      <div class="title">营业时间</div>
      <div class="value" v-text="shop.businessTime[0]+'~'+shop.businessTime[1]"></div>
    </div>

    <shop-bottom-nav/>
  </div>
</template>

<script>
import ShopHeader from '../common/ShopHeader'
import ShopBottomNav from '../common/ShopBottomNav'
export default {
  name: 'ShopDescription',
  components: {ShopBottomNav, ShopHeader},
  data:function () {
    return {
      shop: {
        id: 0,
        name: '',
        logo: this.NoImageUrl,
        isCollect: false,
        collectNums: 0,
        productNums: 0,
        location: [],
        province: '',
        city: '',
        county: '',
        address: '',
        businessTime: '',
        sameCitySend: true,
        banner: []
      }
    }
  },
  mounted () {
    this.getDetail()
  },
  methods:{
    getDetail: function () {
      let $this = this
      $this.MyRequest($this.ApiDoNameShop + 'Shop/getDetail', {
        id: $this.$route.query.id
      }, function (data) {
        $this.isLoading = false
        $this.shop = data
        $this.$forceUpdate()
      }, function (data) {
        $this.isLoading = false
        $this.successTip(data.message, 'error')
      })
    },
    getMapSrc:function () {
      var addressDetail=this.shop.province+','+this.shop.city+','+this.shop.county+' '+this.shop.address;
      var url=window.location.protocol+'//'+window.location.host+'/static/amap-location.html?name='+this.shop.name+'&address='+addressDetail+'&location='+this.shop.location.join(',')
      // console.log('url',url)
      return url
    }
  }
}
</script>

<style scoped>

</style>
